没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|使用教程|编辑:胡涛|2022-05-26 14:04:50.353|阅读 332 次
概述:本文主要介绍了如何在 C# 中为 Word 段落添加制表位,欢迎查阅!
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
制表位是放置在标尺上的标记,用于定义文本或数字在一行上的对齐方式。要在 Microsoft Word 中为段落添加制表位,我们需要打开制表符对话框,然后设置制表位位置、对齐方式和前导符,如下所示。
本文详细介绍了如何使用 Spire.Doc 以编程方式将制表位添加到 Word 文档中的段落。
详细步骤:
第 1 步:实例化一个 Document 对象并向其添加一个部分。
Document document = new Document(); Section section = document.AddSection();
第 2 步:将第 1 段添加到该部分。
Paragraph paragraph1 = section.AddParagraph();
第 3 步:将制表位添加到第 1 段。
//Add tab and set its position (in points) Tab tab = paragraph1.Format.Tabs.AddTab(28); //Set tab alignment tab.Justification = TabJustification.Left; //move to next tab and append text paragraph1.AppendText("\tWashing Machine"); //Add another tab and set its position (in points) tab = paragraph1.Format.Tabs.AddTab(280); //Set tab alignment tab.Justification = TabJustification.Left; //Specify tab leader type tab.TabLeader = TabLeader.Dotted; //move to next tab and append text paragraph1.AppendText("\t$650");
第 4 步:将第 2 段添加到该部分。
Paragraph paragraph2 = section.AddParagraph();
第 5 步:将制表位添加到第 2 段。
//Add tab and set its position (in points) tab = paragraph2.Format.Tabs.AddTab(28); //Set tab alignment tab.Justification = TabJustification.Left; //move to next tab and append text paragraph2.AppendText("\tRefrigerator"); //Add another tab and set its position (in points) tab = paragraph2.Format.Tabs.AddTab(280); //Set tab alignment tab.Justification = TabJustification.Left; //Specify tab leader type tab.TabLeader = TabLeader.NoLeader; //move to next tab and append text paragraph2.AppendText("\t$800");
第 6 步:保存并关闭文档对象。
document.SaveToFile("Tab.docx", FileFormat.Docx2013); document.Close();
截图:
完整代码:
using Spire.Doc; using Spire.Doc.Documents; namespace AddTapStops { class Program { static void Main(string[] args) { //Instantiate a Document object Document document = new Document(); //Add a section Section section = document.AddSection(); //Add paragraph 1 Paragraph paragraph1 = section.AddParagraph(); //Add tab and set its position (in points) Tab tab = paragraph1.Format.Tabs.AddTab(28); //Set tab alignment tab.Justification = TabJustification.Left; //move to next tab and append text paragraph1.AppendText("\tWashing Machine"); //Add another tab and set its position (in points) tab = paragraph1.Format.Tabs.AddTab(280); //Set tab alignment tab.Justification = TabJustification.Left; //Specify tab leader type tab.TabLeader = TabLeader.Dotted; //move to next tab and append text paragraph1.AppendText("\t$650"); //Add paragraph 2 Paragraph paragraph2 = section.AddParagraph(); //Add tab and set its position (in points) tab = paragraph2.Format.Tabs.AddTab(28); //Set tab alignment tab.Justification = TabJustification.Left; //move to next tab and append text paragraph2.AppendText("\tRefrigerator"); //move to next tab and append text //Add another tab and set its position (in points) tab = paragraph2.Format.Tabs.AddTab(280); //Set tab alignment tab.Justification = TabJustification.Left; //Specify tab leader type tab.TabLeader = TabLeader.NoLeader; //move to next tab and append text paragraph2.AppendText("\t$800"); //Save and close the document object document.SaveToFile("Tab.docx", FileFormat.Docx2013); document.Close(); } } }
欢迎下载|体验更多E-iceblue产品
如需获取更多产品相关信息请咨询慧都在线客服
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
将数据库数据导出为 Excel 文件,也因此成为实现报表生成、审计追踪、数据迁移和临时分析等需求时的一种高频操作。本文将介绍如何使用 Spire.XLS for .NET 通过 C# 将数据库记录高效导出到 Excel 文件。示例以 SQL Server 数据库为基础,但相同方法也适用于 SQLite、MySQL、Oracle 等其他关系型数据库,只需调整连接方式即可。
本教程主要为大家介绍DevExpress WinForms数据网格控件中数据过滤基础知识和过滤面板设置,欢迎下载最新版组件体验!
将多张PNG图像合并为一个PDF文件是文档处理中的常见需求。无论是存档、报告、作品集、演示文稿,还是将扫描页面转换为单个文件,如果没有合适的工具,这都可能非常耗时。本指南将介绍如何使用 C#、Java 和 Python 编程实现快速将 PNG 图像合并为 PDF。
本文将为大家介绍如何使用MyEclipse中的Web Fragment项目来模块化Web应用部署描述符,欢迎下载最新版体验!
Spire.Doc for .NET 是一款专门对 Word 文档进行操作的 .NET 类库。
Spire.XLS for .NETSpire.XLS for .NET是专业.NET Excel组件,快速完成对Excel各类编程操作
Aspose.Words for .NET无需Microsoft Word也可在任何平台上满足Word文档的一切操作需求。
Aspose.PDF for .NETPDF文档创建组件,无需Adobe Acrobat,也可以在任何平台上操作PDF文档。
VMProtect新一代软件保护系统,将保护后的代码放到虚拟机中运行,代码反编译软件反破解。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号